package com.bt7274.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;

/**
 * <p>
 * 促销策略配置表
 * </p>
 *
 * @author hp
 * @since 2025-06-12
 */
@TableName("promotion_policy")
public class PromotionPolicy implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键ID，唯一标识每条促销策略记录
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 策略唯一标识符（URL友好名称），用于前端展示和API调用
     */
    private String slug;

    /**
     * 策略显示名称（如"新用户专享"、"节日特惠"等）
     */
    private String displayName;

    /**
     * 上传奖励比例（例如1.5表示上传1GB可获得1.5GB的量）
     */
    private Double uploadRatio;

    /**
     * 下载折扣比例（例如0.8表示下载1GB可获得0.8GB的量）
     */
    private Double downloadRatio;

    /**
     * bt币折扣比例（例如0.5表示下载费用打5折）
     */
    private Double btRatio;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSlug() {
        return slug;
    }

    public void setSlug(String slug) {
        this.slug = slug;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public Double getUploadRatio() {
        return uploadRatio;
    }

    public void setUploadRatio(Double uploadRatio) {
        this.uploadRatio = uploadRatio;
    }

    public Double getDownloadRatio() {
        return downloadRatio;
    }

    public void setDownloadRatio(Double downloadRatio) {
        this.downloadRatio = downloadRatio;
    }

    public Double getBtRatio() {
        return btRatio;
    }

    public void setBtRatio(Double btRatio) {
        this.btRatio = btRatio;
    }

    @Override
    public String toString() {
        return "PromotionPolicy{" +
        "id = " + id +
        ", slug = " + slug +
        ", displayName = " + displayName +
        ", uploadRatio = " + uploadRatio +
        ", downloadRatio = " + downloadRatio +
        ", btRatio = " + btRatio +
        "}";
    }

    public double applyUploadRatio(double upload) {
        return upload * uploadRatio;
    }

    public double applyDownloadRatio(double download) {
        return download * downloadRatio;
    }
}
